#!/usr/bin/env python
# Simple Server

from socket import *

host = ''
port = 8888

s = socket(AF_INET, SOCK_STREAM)
s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
s.bind((host, port))
s.listen(1)

print 'Server is running on port %d; press Ctrl-C to terminate.' % port

while 1:
    clientsock, clientaddr = s.accept()
    clientfile = clientsock.makefile('rw', 0)
    line = clientfile.readline().strip()
    print line
    clientfile.close()
    clientsock.close()
